package com.oa.dao.impl;

import org.hibernate.Session;
import org.hibernate.SessionFactory;

import com.oa.bean.work.Dept;
import com.oa.dao.TestDAO;

public class TestDAOImpl implements TestDAO {
	private SessionFactory sessionFactory;

	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}

	@Override
	public Dept queryDept() {
		Session session = sessionFactory.openSession();
		session.beginTransaction();
		Dept d = (Dept) session.get(Dept.class, 1);
		session.getTransaction().commit();
		return d;
	}

}
